colorchooser: Fix a crash
authorMatthias Clasen <mclasen@redhat.com>
Thu, 16 Apr 2020 21:08:31 +0000 (17:08 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 18 Apr 2020 07:29:13 +0000 (03:29 -0400)
Don't crash when we start removing custom colors
that happen to be currently selected.

gtk/gtkcolorchooserwidget.c

index a6b3c5cc53fba55a6547050e02b0d538ed75e3c1..5dbb3b1aa4f057b153c844b1079538d2dec60419 100644 (file)
@@ -794,6 +794,9 @@ add_custom_color (GtkColorChooserWidget *cc,
     {
       GtkWidget *last = gtk_widget_get_last_child (cc->custom);
 
+      if (last == (GtkWidget *)cc->current)
+        cc->current = NULL;
+
       gtk_container_remove (GTK_CONTAINER (cc->custom), last);
     }
   g_list_free (children);